<?php

namespace App\Http\Resources;

use App\DTO\Airport;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class AirportResource extends JsonResource
{

    /**
     * @var Airport
     */
    public $resource;
    /**
     * Transform the resource into an array.
     *
     * @return array<string, mixed>
     */
    public function toArray(Request $request): array
    {
        return [
            'code' => $this->resource->getCode(),
            'cityName' => $this->resource->getCityName(),
            'country' => $this->resource->getCountry(),
            'lat' => $this->resource->getLat(),
            'lng' => $this->resource->getLng(),
            'timezone' => $this->resource->getTimezone(),
            'area' => $this->resource->getArea()
        ];
    }
}
